package com.group3.config;

import com.group3.filter.JWTInterceptor;
import com.group3.filter.AuthorityInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

//@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new JWTInterceptor())
//                .addPathPatterns("/**")
//                .excludePathPatterns("/login");
//        registry.addInterceptor(new AuthorityInterceptor("0"))
//                .addPathPatterns("/admin/**");
//        registry.addInterceptor(new AuthorityInterceptor("1"))
//                .addPathPatterns("/teacher/**");
//        registry.addInterceptor(new AuthorityInterceptor("2"))
//                .addPathPatterns("/student/**");
    }

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        //        addResourceHandler是指你想在url请求的路径
        // addResourceLocations是图片存放的真实路
        registry.addResourceHandler("doc.html")
                .addResourceLocations("classpath:/META-INF/resources/");
    }
}
